package com.qf.mpswaggershiro.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@Configuration
public class SwaggerConfig {

    @Bean
    public Docket docket(){

       return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(getApiUnfo())
                .select()
                //指定swagger扫描controller路径
                .apis(RequestHandlerSelectors.basePackage("com.qf.mpswaggershiro"))
                .build();

    }

    private ApiInfo getApiUnfo() {

       return new ApiInfoBuilder()
               .contact(new Contact("Mr.崔","http://www.baidu.com","woyao88888@qq.com"))
               .title("锋迷商城文档")
               .version("1.0.1")
               .description("所有后端接口的详细文档，使用swagger自动生成的")
                .build();
    }
}
